package Code.Day3_20240920.com.dx.day03;

import java.util.Arrays;
import java.util.Comparator;

/**
 * @ClassName Sort
 * @Description 排序(使用Arrays)
 * @Author 12994
 * @Date 2024/9/20 10:35
 * @Version 1.0
 **/
public class Sort {
    public static void main(String[] args) {
        Integer[] prices = {10, 20, 300, 400, 90, -15};
        //
//        Arrays.sort(prices, new Comparator<>() {
//            @Override
//            public int compare(Integer o1, Integer o2) {
//                return o1 - o2;
//            }
//        });
        // 降序Lambda
        Arrays.sort(prices, (o1, o2) -> o2 - o1);
        System.out.println(Arrays.stream(prices).toList());
    }
}
